#ifndef _TaskManager
#define _TaskManager

#include <time.h>

#include "BlockManager.h"
#include "Stopwatch.h"
#include "Connection.h"
#include "ParamManager.h"
#include "common.h"


#include <openssl/bn.h>
#pragma comment (lib, "libeay32.lib")


enum State {
	PENDING,
	ACTIVE,
	COMPLETE
};

struct Task {
	char *id;
	State state;
	ParamManager sm;
	BlockManager bm;
	Stopwatch sw;

	Task *prev, *next;
};

class TaskManager {
public:
	Task *head;
	BIGNUM *id;

	// Constructor
	TaskManager();

	// Deconstructor
	~TaskManager();

	// add a new task
	Task* add(void);

	// del a task by the specified id
	bool del(char* /*id*/);

	// get a task by the specified id
	Task* get(char* /*id*/);

	// lists current tasks
	void list(Connection* /*conn*/, char *status);
};

#endif // _TaskManager